

package com.server;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author JOKE
 * Entity class for Database access
 */
@Entity
@Table(name = "PLAYER")
@NamedQueries({
    @NamedQuery(name = "PlayerEntity.findAll", query = "SELECT p FROM "
    + "PlayerEntity p"),
    @NamedQuery(name = "PlayerEntity.findById", query = "SELECT p FROM "
    + "PlayerEntity p WHERE p.id = :id"),
    @NamedQuery(name = "PlayerEntity.findByUsername", query = "SELECT p "
    + "FROM PlayerEntity p WHERE p.username = :username"),
    @NamedQuery(name = "PlayerEntity.findByPassword", query = "SELECT p "
    + "FROM PlayerEntity p WHERE p.password = :password"),
    @NamedQuery(name = "PlayerEntity.findByGameplayed", query = "SELECT p "
    + "FROM PlayerEntity p WHERE p.gameplayed = :gameplayed"),
    @NamedQuery(name = "PlayerEntity.findByGamewon", query = "SELECT p FROM "
    + "PlayerEntity p WHERE p.gamewon = :gamewon"),
    @NamedQuery(name = "PlayerEntity.findByGameratio", query = "SELECT p FROM "
    + "PlayerEntity p WHERE p.gameratio = :gameratio")})
public class PlayerEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Column(name = "USERNAME")
    private String username;
    @Column(name = "PASSWORD")
    private String password;
    @Column(name = "GAMEPLAYED")
    private Integer gameplayed;
    @Column(name = "GAMEWON")
    private Integer gamewon;
    @Column(name = "GAMERATIO")
    private Double gameratio;

    public PlayerEntity() {
    }

    public PlayerEntity(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getGameplayed() {
        return gameplayed;
    }

    public void setGameplayed(Integer gameplayed) {
        this.gameplayed = gameplayed;
    }

    public Integer getGamewon() {
        return gamewon;
    }

    public void setGamewon(Integer gamewon) {
        this.gamewon = gamewon;
    }

    public Double getGameratio() {
        return gameratio;
    }

    public void setGameratio(Double gameratio) {
        this.gameratio = gameratio;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields
        // are not set
        if (!(object instanceof PlayerEntity)) {
            return false;
        }
        PlayerEntity other = (PlayerEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null &&
                !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.server.PlayerEntity[id=" + id + "]";
    }

}
